<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateStoreTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('good_id');//商品id
            $table->integer('shop_id');//店铺id
            $table->string('type',16);//商品销售类别 -> 拼团 直售
            $table->string('inventory_sn',255);//商品批号
            $table->string('virtual_sn',255);//虚拟商品批号
            $table->decimal('present_cost',10,2);//商品现价
            $table->decimal('group_cost',10,2);//团购价
            $table->decimal('guarantee_cost')->nulable();//担保金
            $table->integer('group_max_num');//成团人员数
            $table->integer('quota');//限购数量
            $table->boolean('consigned')->default(false);//是否开启寄售
            $table->boolean('module_taobao_mobile')->default(false);//手机淘宝模式
            $table->boolean('module_taobao_command')->default(false);//淘口令模式
            $table->string('taobao_command',320)->nullable();//淘口令
            $table->integer('sort')->default(99);//商品排序
            $table->timestamp('putaway_time')->nullable();//上架时间
            $table->timestamp('soldout_time')->nullable();//下架时间
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store');
    }
}
